package com.example.mall_system.mapper;

import com.example.mall_system.entity.Address;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; // 添加Param注解导入
import java.util.List;

@Mapper
public interface AddressMapper {
    List<Address> getAllAddresses();

    Address selectByIdAndUserId(@Param("id") Long id, @Param("userId") Long userId);
    
    List<Address> selectByUserId(@Param("userId") Long userId);
    
    Address selectDefaultByUserId(@Param("userId") Long userId);
    
    int insert(Address address);
    
    int update(Address address);
    
    int deleteById(@Param("id") Long id, @Param("userId") Long userId);
    
    int setDefault(@Param("id") Long id, @Param("userId") Long userId);

    List<Address> selectAll();
}